package com.jiangruan.javaproject.service;

import com.alibaba.fastjson.JSONObject;
import com.jiangruan.javaproject.Constants;
import com.jiangruan.javaproject.bean.Moblies;
import com.jiangruan.javaproject.request.HttpUtils;

import java.util.Scanner;

/**
 * @author:xulonghua
 * @email:3162193565@qq.com
 * @desc:聚合数据手机查询功能
 * @datetime 2021/12/26 17:38
 */
public class MoblieQuery {
    public  Moblies  moblie(){
        Scanner scanner = new Scanner ( System.in );
        System.out.println ("输入你的手机号");
        String phone = scanner.next ();
        String url= Constants.MoblieQuery_URL+"?phone="+phone+"&key="+Constants.MoblieQuery_KEY;
        String result = HttpUtils.get ( url );
        //json解析
        Moblies moblies = JSONObject.parseObject ( result, Moblies.class );
        return moblies;
    }

    public static void main(String[] args) {

    }
}
